<?php

namespace Admin\Controller;
//use Think\Controller;
use Tools\AdminController;

/**
* 后台登陆系统
*/
class IndexController extends AdminController
{
	
	function head()
	{
		$this->display();
	}
	function left()
	{
		//管理员及权限
		//根据ID查信息
		$admin_id=session('admin_id');
		$admin_name=session('admin_name');
		$manager_info=D('Manager')->find($admin_id);
		$role_id=$manager_info['mg_role_id'];

		//根据ID查权限
		$role_info=D('Role')->find($role_id);
		$auth_ids=$role_info['role_auth_ids'];

		//根据权限查可用权限菜单，父级之级分开查，方便前端调用
		if ($admin_name=== 'admin'){
			$auth_infoP=D('Auth')->where("auth_level=0")->select();
			$auth_infoC=D('Auth')->where("auth_level=1")->select();
		}
		else {
			$auth_infoP = D('Auth')->where("auth_level=0 and auth_id in ($auth_ids)")->select();
			$auth_infoC = D('Auth')->where("auth_level=1 and auth_id in ($auth_ids)")->select();
		}


		$this->assign('auth_infoP',$auth_infoP);
		$this->assign('auth_infoC',$auth_infoC);
		$this->display();
	}
	function right()
	{
		$this->display();
	}
	function index()
	{
		$this->display();
	}
}